<template>
	<view class="">
		<businessCard :businessCardInformation="businessCardInformation" :userInfo="userInfo"></businessCard>
		<sameTrade v-if="type == 1" :information="information"></sameTrade>
		<cooperation v-else-if="type == 2" :information="information"></cooperation>
		<answerQuestions v-else-if="type == 3" :information="information"></answerQuestions>
		<comment-area :id="information.id" :type="type + 2"></comment-area>
		<xy-loading v-if="loadingShowStatus"></xy-loading>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import {
		sendPostRequest
	} from '@/api/networkSquare'
	import sameTrade from './components/same_trade.vue'
	import cooperation from './components/cooperation'
	import answerQuestions from './components/answer_questions.vue'
	import businessCard from '../components/business_card.vue'
	export default {
		components:{
			sameTrade,
			cooperation,
			businessCard,
			answerQuestions
		},
		data() {
			return {
				id:1,
				type:1,
				loadingShowStatus:false,
				businessCardInformation:[],
				information:[]
			}
		},
		onLoad(e) {
			if(e.type && e.id){
				this.id = e.id;
				this.type = parseInt(e.type);
				this.queryBasicInformationFun()
			}
		},
		methods:{
			async queryBasicInformationFun() {
				let _this = this;
				let d = await sendPostRequest('articlInfo',{
					type:_this.type,
					id:_this.id,
				},'数据价值中');
				uni.hideLoading()
				console.log(d)
				if(d.code == 1){
					_this.businessCardInformation = d.data.business_card_information;
					_this.information = d.data.data;
				}
				_this.loadingShowStatus = false;
			},
		},
		computed: {
			...mapGetters(["userInfo"]),
		}
	}
</script>

<style lang="scss">
	page {
		min-height: 100vh;
		background: linear-gradient(to top, #F7F7F7 60%,  rgba(120, 201, 255, 1) 100%);
	}
</style>